/*
 * Date: 2018年01月02日 09:32:33
 * LastEditors: lvyou
 * LastEditTime: 2020年04月16日 16:21:52
 * FilePath: \youlinweb-master\src\main.js
 * copyright(c) 2019-2025 版权为浙江双城网络科技集团有限公司所有，违者必究。
 */
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
require('less/public.less')
import Vue from 'vue'
import App from './App'
import VueLazyload from 'vue-lazyload'
import MintUI from 'mint-ui'
import {
  MessageBox
} from 'mint-ui';

//实现复制功能
// import { iScroll } from '../static/iscroll'
// import { bridge } from '../static/bridge'
import 'mint-ui/lib/style.css'


import router from './router'
import store from './vuex/store'
import './config/rem'
import util from './config/util'
import ylheader from "src/components/yl-header.vue";
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
window._each = require('lodash/each') // 引入lodash
// window.$ = require('jquery')
//实现复制功能
// window.iScroll =iScroll
// window.bridge =bridge
// require("../static/jquery.arctext.js");
import { Popup } from 'mint-ui';

Vue.component(Popup.name, Popup);


Vue.component('ylheader', ylheader)
Vue.config.productionTip = false
//添加emit/on事件
Vue.prototype.eventHub = Vue.prototype.eventHub || new Vue()
Vue.prototype.$bus = new Vue()
Vue.prototype.$onBus = function (event, callback) {
  this.$bus.$on(event, callback)
  return () => this.$bus.$off(event, callback)
}
Vue.prototype.$util = util;




// v-lazy  懒加载
Vue.use(VueLazyload, {
  loading: '',
  error: '',
  preLoad: 1,
  attempt: 2,
  filter: {
    webp(listener, options) {
      if (!options.supportWebp) return
      const isCDN = /wonderlandnet|clouddn/
      if (isCDN.test(listener.src)) {
        if(listener.src.indexOf('imageMogr2')>-1||listener.src.indexOf('imageView2')>-1){
          listener.src += '/imageView2/2/format/webp/ignore-error/1'
        }else{
          listener.src += '?imageView2/2/format/webp/ignore-error/1'
        }
      }
    }
  }
})
Vue.use(MintUI)
Vue.use(VueAwesomeSwiper)
Vue.mixin({
  methods: {
    dialog(msg) {
      MessageBox({
        title: '',
        message: msg || '未知异常'
      });
    }
  }
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  render: h => h(App)
})
